package com.homegoods.home.activity;

import android.os.Bundle;
import android.support.v7.widget.RecyclerView;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.homegoods.home.R;
import com.homegoods.home.databinding.HomeMoreNewProductBinding;
import com.homegoods.home.presenters.MoreNewProductPresenter;
import com.homegoods.resource.SpacesItemDecoration;
import com.homegoods.aroutercomment.ARouterPath;
import com.homegoods.resource.util.Utils;
import com.kedll.library.base.KRefreshListActivity;
import com.kedll.library.util.MyUtils;

/**
 * @author QiQi
 * @description 更多新品发布列表
 */
@Route(path = ARouterPath.PATH_NEW_PRODUCT)
public class MoreNewProductActivity extends KRefreshListActivity<HomeMoreNewProductBinding, MoreNewProductPresenter> {
    @Autowired
    public String childSid;

    @Override
    public int getLayout() {
        return R.layout.home_more_new_product;
    }

    @Override
    protected void initToolBar(Bundle savedInstanceState) {
        super.initToolBar(savedInstanceState);
        setTitle("新品发布");

    }

    @Override
    protected MoreNewProductPresenter getPresenter() {
        ARouter.getInstance().inject(this);
        return new MoreNewProductPresenter(this,childSid);
    }

    @Override
    protected void initData(Bundle savedInstanceState) {
        super.initData(savedInstanceState);
        list.setPadding(MyUtils.dp2px(8), MyUtils.dp2px(8), MyUtils.dp2px(8), 0);
        list.setClipToPadding(false);
        list.addItemDecoration(new SpacesItemDecoration(2, 8));
    }

    @Override
    protected RecyclerView.LayoutManager getLayoutManager() {
        return Utils.getGridLayoutManager(getContext(), adapter, 2);
    }
}
